home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / PSFile.rtf,v < prev    next >
Text File  |  1995-06-12  |  11KB  |  512 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.2;
  5. locks    death:1.3;
  6. comment  @@;
  7.  
  8.  
  9. 1.3
  10. date     93.04.04.23.44.54;  author death;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     93.01.10.15.08.37;  author death;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     92.07.26.13.54.15;  author death;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @basic ps file doc (doubtlessly WRONG)
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Sun Apr  4 23:44:54 PDT 1993
  33. @
  34. text
  35. @{\rtf0\ansi{\fonttbl\f0\fnil Palatino-Roman;\f1\ftech Symbol;\f2\fnil Times-Roman;\f4\fnil NewCenturySchlbk-Roman;}
  36. \paperw14520
  37. \paperh15300
  38. \margl120
  39. \margr0
  40. {\colortbl\red0\green0\blue0;}
  41. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.2 $    $Author: death $    $Date: 93/01/10 15:08:37 $\
  42.  
  43. \pard \
  44.  
  45. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  46.  
  47. \fs28 \
  48.  
  49. \fs16 \
  50.  
  51. \fs28 \
  52.  
  53. \fs16 \
  54.  
  55. \pard\b\li1100 \
  56. \
  57. \
  58. \
  59.  
  60. \fs36 PSFile\
  61.  
  62. \fs16 \
  63.  
  64. \pard\tx7140\b0\fs28\li2100 INHERITS FROM    File\
  65.  
  66. \fs16 \
  67.  
  68. \fs28 DECLARED IN    PSFile.h\
  69.  
  70. \fs16 \
  71. \
  72. \
  73.  
  74. \fs28 CLASS DESCRIPTION\
  75.  
  76. \fs16 \
  77.  
  78. \pard\tx3120\tx3620\tx4120\fs28\li2620 The PSFile class is a simple specilization of the File class.  It merely provides several methods for interacting with a file making reference to strings and lines of text, rather than arbitrary chunks of bytes.\
  79.  
  80. \fs16 \
  81.  
  82. \fs28 The current version is definitely incomplete, and only has the methods that I've direly needed so far.  Most notably, it is really only usefull for 
  83. \i writing
  84. \i0  to.  There are no specilized reading methods.\
  85.  
  86. \fs16 \
  87.  
  88. \fs28 At the moment, this allows one to append another file to the contents of the current one (usefull for importing a set of procedures and other definitions that this file will need), writing DSC comments (%%foo: ...), lines of text, and dumping a string of bytes has hex data.  Additionally, it supports two methods that do printf() type of formatting.  These are cruder than I'd like, and someday should be made prettier.  \
  89. \
  90.  
  91. \fs16 \
  92.  
  93. \pard\tx7140\li2100 \
  94. \
  95.  
  96. \fs28 INSTANCE VARIABLES\
  97.  
  98. \fs16 \
  99.  
  100. \pard\tx7140\tx10180\tx10680\i\fs28\fi-4540\li7140 Inherited from Object
  101. \i0     Class    isa;\
  102.  
  103. \fs16 \
  104.  
  105. \i\fs28 Declared in PSFile
  106. \i0     None\
  107.  
  108. \pard\tx7140\fs16\li2100 \
  109. \
  110. \
  111.  
  112. \fs28 METHOD TYPES\
  113.  
  114. \fs16 \
  115.  
  116. \pard\tx7140\tx10180\tx10680\fs28\fi-4540\li7140 From other files    
  117. \f1 - 
  118. \f0 AppendFrom:\
  119.  
  120. \fs16 \
  121.  
  122. \fs28 Comments    
  123. \f1 - 
  124. \f0 WriteDSCComment:\
  125.  
  126. \pard\tx10180\tx10680\f1\fi-520\li7660 - 
  127. \f2 WriteFormattedDSCComment::
  128. \f1 \
  129. \f2 WriteComment:\
  130.  
  131. \f1 - 
  132. \f2 WriteFormattedComment::
  133. \f1 \
  134.  
  135. \pard\tx7140\tx10180\tx10680\f0\fs16\fi-4540\li7140 \
  136.  
  137. \fs28 Data output    
  138. \f1 - 
  139. \f0 WritePSLine:\
  140.  
  141. \pard\tx10180\tx10680\f1\fi-520\li7660 - 
  142. \f0 WriteFormattedPSLine
  143. \fc0 :\
  144.  
  145. \f1 - 
  146. \f0 Write:
  147. \pard\tx533\tx1067\tx1601\tx2135\tx2668\tx3202\tx3736\tx4270\tx4803\tx5337\fc0 BytesOfHexDataFrom
  148. \pard\tx10180\tx10680\fi-520\li7660\fc0 :
  149. \
  150.  
  151. \f1 - 
  152. \f0 Write:Inverted
  153. BytesOfHexData
  154. :\
  155.  
  156. \f1 - 
  157. \f0 ForceNewLine
  158. \
  159.  
  160. \f1 - 
  161. \f0 WriteByteAsHex
  162. :\
  163.  
  164. \pard\tx7140\fs16\li2100 \
  165. \
  166. \
  167.  
  168. \fs28 CLASS METHODS\
  169.  
  170. \fs16 \
  171.  
  172. \b \
  173.  
  174. \b0\fs28 None\
  175.  
  176. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  177.  
  178. \pard\tx7140\li2100 \
  179. \
  180.  
  181. \fs28 INSTANCE METHODS\
  182.  
  183. \fs16 \
  184.  
  185. \b \
  186.  
  187. \fs28 AppendFrom:\
  188.  
  189. \pard\f1\b0\fi-1020\li3620 - 
  190. \f0\b AppendFrom: 
  191. \b0\i file
  192. \b\i0 \
  193.  
  194. \fs16 \
  195.  
  196. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Inserts the entire contents of 
  197. \i file
  198. \i0  into the current position of the file.\
  199.  
  200. \fs16 \
  201.  
  202. \pard\tx7140\b\li2100 \
  203.  
  204. \fs28 WriteDSCComment:\
  205.  
  206. \pard\f1\b0\fi-1020\li3620 - 
  207. \f0\b WriteDSCComment: 
  208. \b0 (CString) 
  209. \i comment
  210. \b\i0 \
  211.  
  212. \fs16 \
  213.  
  214. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Writes the specified string out as a PS DSC comment.  Hence, if given `BoundingBox: 45, 67, 87,90', this will write out: `%%Boundingbox: 45, 67, 87, 90'.  \
  215.  
  216. \pard\tx7140\fs16\li2100 \
  217.  
  218. \b \
  219.  
  220. \fs28 WriteDSCCommentUsing:WithFormat:
  221. \b0 \
  222.  
  223. \pard\fi-1020\li3620 - 
  224. \b WriteDSCCommentUsing: 
  225. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  226. \pard\i\fi-1020\li3620 buffer
  227. \b\i0  WithFormat: 
  228. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  229. \pard\i\fi-1020\li3620 format
  230. \i0 , ...
  231. \b \
  232.  
  233. \fs16 \
  234.  
  235. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This also writes a DSC comment.  however, it uses a printf-like calling syntax.  Arguments after the format will be used to generate the finished comment string.  This form must be viewed as an intermediate form in two respects: I'm not yet sure whether I should be being passed a buffer or a maximum size of the buffer.  Additionally, ideally a later version or different method will do all this without the user passing a buffer.  in any case, the buffer passed is used by the routine to build the final formatted string.  If it is not long enough, the results are unpredictable.  The format string is used, in printf fashion, to dictate the consumption of following arguments, and they are displayed as specified by the printf type syntax in the format string.  The formatted string is then written to the file.\
  236.  
  237. \fs16 \
  238.  
  239. \pard\tx7140\b\li2100 \
  240.  
  241. \fs28 WriteComment:\
  242.  
  243. \pard\f1\b0\fi-1020\li3620 - 
  244. \f0\b WriteComment: 
  245. \b0 (CString) 
  246. \i comment
  247. \b\i0 \
  248.  
  249. \fs16 \
  250.  
  251. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Writes the specified string out as a PS comment.  Hence, if given `We now start the inifinite loop', this will write out: `% We now start the infinite loop'.  \
  252.  
  253. \pard\tx7140\fs16\li2100 \
  254.  
  255. \b \
  256.  
  257. \fs28 WriteCommentUsing:WithFormat:
  258. \b0 \
  259.  
  260. \pard\fi-1020\li3620 - 
  261. \b WriteCommentUsing: 
  262. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  263. \pard\i\fi-1020\li3620 buffer
  264. \b\i0  WithFormat: 
  265. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  266. \pard\i\fi-1020\li3620 format
  267. \i0 , ...
  268. \b \
  269.  
  270. \fs16 \
  271.  
  272. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This is identical to WriteFormatttedDSCComment:: ,save that it writes a simple PS comment, and not a DSC one.\
  273.  
  274. \fs16 \
  275.  
  276. \pard\tx7140\b\li2100 \
  277.  
  278. \fs28 WriteText:\
  279.  
  280. \pard\f1\b0\fi-1020\li3620 - 
  281. \f0\b WriteText: 
  282. \b0 (CString) 
  283. \i text
  284. \b\i0 \
  285.  
  286. \fs16 \
  287.  
  288. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes the specified text out to the destination file litterally. \
  289.  
  290. \pard\tx7140\fs16\li2100 \
  291.  
  292. \b \
  293.  
  294. \fs28 WriteTextUsing:WithFormat:
  295. \b0 \
  296.  
  297. \pard\fi-1020\li3620 - 
  298. \b WriteTextUsing: 
  299. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  300. \pard\i\fi-1020\li3620 buffer
  301. \b\i0  WithFormat: 
  302. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  303. \pard\i\fi-1020\li3620 format
  304. \i0 , ...
  305. \b \
  306.  
  307. \fs16 \
  308.  
  309. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This is like WriteFormattedComment, save that it writes out a line of text, not a comment..\
  310.  
  311. \fs16 \
  312.  
  313. \pard\tx7140\b\li2100 \
  314.  
  315. \fs28 WritePSLine:\
  316.  
  317. \pard\f1\b0\fi-1020\li3620 - 
  318. \f0\b WritePSLine: 
  319. \b0 (CString) 
  320. \i text
  321. \b\i0 \
  322.  
  323. \fs16 \
  324.  
  325. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes the specified text out to the destination file, terminating it with a LF. \
  326.  
  327. \pard\tx7140\fs16\li2100 \
  328.  
  329. \b \
  330.  
  331. \fs28 WritePSLineUsing:WithFormat:
  332. \b0 \
  333.  
  334. \pard\fi-1020\li3620 - 
  335. \b WritePSLineUsing: 
  336. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  337. \pard\i\fi-1020\li3620 buffer
  338. \b\i0  WithFormat: 
  339. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fi-1020\li3620 (CString) 
  340. \pard\i\fi-1020\li3620 format
  341. \i0 , ...
  342. \b \
  343.  
  344. \fs16 \
  345.  
  346. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This is like WriteFormattedComment, save that it writes out a line of PS code and terminates it with a newline.\
  347.  
  348. \fs16 \
  349.  
  350. \pard\tx7140\b\li2100 \
  351.  
  352. \fs28 ForceNewLine\
  353.  
  354. \pard\f1\b0\fi-1020\li3620 - 
  355. \f0\b ForceNewLine\
  356.  
  357. \fs16 \
  358.  
  359. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This little kludge merely inserts a LF character into the file.\
  360.  
  361. \fs16 \
  362.  
  363. \pard\tx7140\b\li2100 \
  364.  
  365. \fs28 WriteByteAsHex\
  366.  
  367. \pard\f1\b0\fi-1020\li3620 -
  368. \f0  
  369. \b WriteByteAsHex: 
  370. \b0 (Byte)
  371. \b  
  372. \b0\i thebyte
  373. \b\i0 \
  374.  
  375. \fs16 \
  376.  
  377. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Given a byte, this will write it out as a hexadecimal number.  Thus, given the byte `A', it writes out `41'.\
  378.  
  379. \fs16 \
  380.  
  381. \pard\tx7140\b\li2100 \
  382.  
  383. \fs28 Write:
  384. \fc0 BytesOfHexDataFrom:
  385. \
  386.  
  387. \pard\f1\b0\fi-1020\li3620 - 
  388. \f0\b Write:
  389. \b0  (PositiveInteger)
  390. \i  num
  391. \i0  
  392. \b\fc0 BytesOfHexDataFrom:
  393. \b0  (ByteString) 
  394. \i buffer
  395. \b\i0 \
  396.  
  397. \fs16 \
  398.  
  399. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes 
  400. \i num
  401. \i0  bytes of binary data from 
  402. \i buffer
  403. \i0  into the file as ascii hex data.  Basically, like a repeated use of WriteByteAsHex:.\
  404.  
  405. \fs16 \
  406.  
  407. \pard\tx7140\b\li2100 \
  408.  
  409. \fs28 Write:Inverted
  410. \fc0 BytesOfHexDataFrom:\
  411.  
  412. \pard\f1\b0\fi-1020\li3620 - 
  413. \f0\b Write:
  414. \b0  (PositiveInteger)
  415. \i  num
  416. \i0  
  417. \b Inverted
  418. \fc0 BytesOfHexDataFrom:
  419. \b0  (ByteString) 
  420. \i buffer
  421. \b\i0 \
  422.  
  423. \fs16 \
  424.  
  425. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This writes 
  426. \i num
  427. \i0  bytes of binary data from 
  428. \i buffer
  429. \i0  into the file as ascii hex data.  Unlike Write:BytesOfHexDataFrom:, this inverts the hex data (1's become 0's, and vice versa) before it converts it..\
  430.  
  431. \fs16 \
  432.  
  433. \pard\tx7140\b\li2100 \
  434.  
  435. \b0 \
  436.  
  437. \fs28 BUGS AND PROBLEMS\
  438.  
  439. \fs16 \
  440.  
  441. \pard\tx3120\tx3620\tx4120\fs28\li2620 This bugger 
  442. \i grew
  443. \i0 .  It was not planned.  And several parts of it really reflect tihs strongly.  A lot could be done to enhance it.  If the need arrives, I'd advocate making a 2.0 revision, say, that completely broke everything that came before.  For now, however, it works even though I'm not entirely sure the Write:... methods do what I always want them to do... (thinking of endian-ness)\
  444.  
  445. \fs16 \
  446.  
  447. \pard\tx7140\li2100 \
  448. \
  449.  
  450. \fs28 ENHANCEMENT IDEAS\
  451.  
  452. \fs16 \
  453.  
  454. \pard\tx3120\tx3620\tx4120\fs28\li2620 DSC comments might take a key and a value argument ('boundingbox' and '45...', and add the colon, space or whatever is required)\
  455.  
  456. \fs16 \
  457.  
  458. \pard\tx7140\li2100 \
  459. \
  460.  
  461. \fs28 CONSTANTS AND DEFINED TYPES\
  462.  
  463. \fs16 \
  464.  
  465. \pard\tx3120\tx3620\tx4120\li2620 \
  466.  
  467. \pard\tx7140\li2100 \
  468. \
  469.  
  470. \fs28 MODIFICATION HISTORY\
  471.  
  472. \fs16 \
  473.  
  474. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    PSFile.rtf,v $
  475. Revision 1.2  93/01/10  15:08:37  death
  476. Sun Jan 10 15:08:36 PST 1993
  477.  
  478. Revision 1.1  92/07/26  13:54:15  death
  479. Initial revision
  480.  
  481. \fi-20\li3120 \
  482.  
  483. }
  484. @
  485.  
  486.  
  487. 1.2
  488. log
  489. @Sun Jan 10 15:08:36 PST 1993
  490. @
  491. text
  492. @d7 1
  493. a7 1
  494. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.1 $    $Author: death $    $Date: 92/07/26 13:54:15 $\
  495. d442 3
  496. @
  497.  
  498.  
  499. 1.1
  500. log
  501. @Initial revision
  502. @
  503. text
  504. @d7 1
  505. a7 1
  506. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.2 $    $Author: death $    $Date: 92/04/05 22:52:03 $\
  507. d441 4
  508. a444 1
  509. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    $
  510. @
  511.